package main

import (
	"Head-first-go/chapter03/example2/datafile"
	"fmt"
	"log"
	"os"
)

func main() {

	pwd, _ := os.Getwd()

	numbers, err := datafile.GetFloats(pwd + "/chapter3/example2/data.txt")
	if err != nil {
		log.Fatal(err)
	}
	var sum float64 = 0

	for _, number := range numbers {
		sum += number
	}
	sampleCont := float64(len(numbers))
	fmt.Printf("The average number is: %0.2f", sum/sampleCont)

}
